/**
@author: LHG
@date: 2021/7/18
@note:
**/
package main

func main() {
	nums := []int{1, 2, 3, 1}
	containsDuplicate(nums)
}

/**

 */
func containsDuplicate(nums []int) bool {
	m := make(map[int]int)
	flag := false
	for i := 0; i < len(nums); i++ {
		m[nums[i]]++
		if m[nums[i]] >= 2 {
			flag = true
			break
		}
	}
	//for _, v := range m {
	//	if v >= 2 {
	//		flag = true
	//		break
	//	}
	//}
	return flag
}
